<template>
  <div class="company-list-1">
    <div class="header">
      <div class="prefix"></div>
      <div class="header-title"><span>待处理告警任务跟踪</span><span>更多></span></div>
    </div>
    <div class="content">
      <el-table
          ref="myTable"
          :data="props.info"
          :row-style="{ height: '20px' }"
          :cell-style="{ padding: '0px' }"
          style="width: 480px; height: 230px"
          :header-cell-style="{ 'text-align': 'center' }"
          :row-class-name="tableRowClassName"
      >
        <el-table-column label="#" width="30" align="center">
          <template #default="{ $index }">
            {{ $index + 1 }}
          </template>
        </el-table-column>
        <el-table-column prop="rearerName" width="100" label="养户" align="center"/>
        <el-table-column prop="alarmType" width="130" label="告警事项" align="center"/>
        <el-table-column prop="alarmLevel" width="100" label="告警等级" align="center"/>
        <el-table-column prop="alarmTime" width="100" label="告警时间" align="center"/>
        <el-table-column prop="taskStatus" width="80" label="状态" align="center">
          <template #default="scope">
            <el-tag
                :type="scope.row.taskStatus === '待派单' ? 'primary' : 'success'"
                effect="dark"
                size="small"
            >{{ scope.row.taskStatus }}
            </el-tag
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script setup>
import {ref, onMounted, onUnmounted} from 'vue'

const props = defineProps({
  info: {
    type: Object,
    default: () => {
    }
  }
})

// 斑马纹
const tableRowClassName = ({row, rowIndex}) => {
  if (rowIndex % 2 == 0) {
    return ''
  } else {
    return 'warning-row'
  }
}
</script>

<style scoped lang="scss">
@import '@/assets/table.css';

.company-list-1 {
  padding: 10px;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  font-size: 16px;

  .header {
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    padding-left: 20px;

    .prefix {
      width: 8px;
      height: 15px;
      background-color: #31a7ff;
    }

    .header-title {
      padding-left: 10px;
      display: flex;
      flex: 1;
      justify-content: space-between;
    }
  }

  .content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;

    &-item1 {
      width: 150px;
      height: 150px;
      background-position: center, center;
      background-repeat: no-repeat, no-repeat;
      background-size: cover, cover;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;

      &-title {
        line-height: 30px;
      }

      &-value {
        font-weight: bold;
        font-size: 24px;
      }
    }
  }
}
</style>
